package com.example.accessdemo;

import cn.hippo4j.core.enable.EnableDynamicThreadPool;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@SpringBootApplication
@EnableDynamicThreadPool
@MapperScan("com.example.accessdemo.mapper")
public class AccessDemoApplication extends SpringBootServletInitializer {

    @Override  //这个表示使用外部的tomcat容器
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的启动类
        return builder.sources(AccessDemoApplication.class);
    }
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(AccessDemoApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        System.out.println("访问链接：http://localhost:" +environment.getProperty("server.port") + "/doc.html");
    }

}
